package ud.prog3.pr02;

public class MiCocheDataModel {
	private boolean[] pressedKeys;
	public static final int ALLOWED_KEYS_NO = 4;
	public static final int AHEAD_KEY = 0;
	public static final int BACK_KEY = 1;
	public static final int RIGHT_KEY = 2;
	public static final int LEFT_KEY = 3;
	
	//AHEAD , BACK, RIGHT, LEFT
	
	public MiCocheDataModel(){
		pressedKeys = new boolean[ALLOWED_KEYS_NO];
	}
	
	public void notifyAheadPressed(){
		pressedKeys[AHEAD_KEY] = true;
	}
	
	public void notifyAheadReleased(){
		pressedKeys[AHEAD_KEY] = false;
	}
	
	public void notifyBackPressed(){
		pressedKeys[BACK_KEY] = true;
	}
	
	public void notifyBackReleased(){
		pressedKeys[BACK_KEY] = false;
	}
	
	public void notifyRightPressed(){
		pressedKeys[RIGHT_KEY] = true;
	}
	
	public void notifyRightReleased(){
		pressedKeys[RIGHT_KEY] = false;
	}
	
	public void notifyLeftPressed(){
		pressedKeys[LEFT_KEY] = true;
	}
	
	public void notifyLeftReleased(){
		pressedKeys[LEFT_KEY] = false;
	}
	
	public boolean isAheadPressed(){
		return pressedKeys[AHEAD_KEY];
	}
	
	public boolean isBackPressed(){
		return pressedKeys[BACK_KEY];
	}
	
	public boolean isRightPressed(){
		return pressedKeys[RIGHT_KEY];
	}
	
	public boolean isLeftPressed(){
		return pressedKeys[LEFT_KEY];
	}
	
	public boolean[] getStatus(){
		return pressedKeys;
	}

}
